<template>
    <el-table v-loading="listLoading" :data="tableData" element-loading-text="Loading"   highlight-current-row     >
      <el-table-column  type="selection" width="25"></el-table-column>
      <el-table-column align="center" label="ID" width="95"> 
        <template slot-scope="scope">{{ scope.row.id}}</template> 
      </el-table-column>
      <el-table-column label="用户名" min-width="110" align="center">
        <template slot-scope="scope"> <span>{{ scope.row.author }}</span> </template>
      </el-table-column>
      <el-table-column label="密码" min-width="150" align="center">
        <template slot-scope="scope"> {{ scope.row.passwd }} </template>
      </el-table-column>
      <el-table-column label="角色" min-width="100" align="center">
        <template slot-scope="scope">
           <el-tag  effect="dark" :type="scope.row.roles | statusFilter">{{ scope.row.roles }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="介绍" min-width="300" align="center">
        <template slot-scope="scope"> {{ scope.row.title }} </template>
      </el-table-column>
      <el-table-column class-name="status-col"  label="操作" width="180"  align="center"  fixed="right">
        <template slot-scope="{ row, $index }">
          <kt-button icon="el-icon-edit" size='mini'  label="设置" perms="sys:adminlist:edit" type="primary" @click="handleUpdate(row)"/>
          <kt-button icon="el-icon-delete" size='mini' label="删除" perms="sys:adminlist:delete" type="danger" @click="handleDelete(row,$index)"/>
        </template>
      </el-table-column>
    </el-table>
</template>
<script>
import { adminlist } from "@/api/infor";
import KtButton from "@/components/elbutton"
export default {
     name: "Aminlist",
     data() {
        return {
          tableData: [{
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
          }, {
            date: '2016-05-04',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1517 弄'
          }, {
            date: '2016-05-01',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1519 弄'
          }, {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          }]
        }
      },
      components:{
     KtButton,
  },
      created() {
       this.fetchData();
  },
  methods:{
     // 获取列表
     fetchData() {
    //   this.listLoading = true;
      adminlist(this.listQuery).then((response) => {
        this.tableData = response.data.data.items;
        console.log(response.data.data)
        // this.listLoading = false;
      });

    },
  }
}
</script>